package com.atguigu.lease.web.app.controller.leasaterm;

import com.atguigu.lease.common.result.Result;
import com.atguigu.lease.model.entity.LeaseTerm;
import com.atguigu.lease.web.app.service.LeaseTermService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Package: com.atguigu.lease.web.app.controller.leasaterm
 *
 * @Description:
 * @Author xiongkunYang
 * @Create 2025/4/23 9:18
 */
@Tag(name = "租期信息")
@RestController
@RequestMapping("/app/term/")
public class LeaseTermController {

    private final LeaseTermService leaseTermService;

    public LeaseTermController(LeaseTermService leaseTermService) {
        this.leaseTermService = leaseTermService;
    }

    @GetMapping("listByRoomId")
    @Operation(summary = "根据房间id获取可选获取租期列表")
    public Result<List<LeaseTerm>> list(@RequestParam Long id) {
        return Result.ok(this.leaseTermService.listByRoomId(id));
    }
}
